package com.wan.zuochengyun_v2.stack_queue;

import java.util.LinkedList;

public class MyQueue<T> {
    private LinkedList<T> queue;

    public MyQueue() {
        this.queue = new LinkedList();
    }

    /**
     * 入队，list尾部入队
     */
    public boolean offer(T val) {
        return queue.offer(val);
    }

    /**
     * null
     */
    public T poll() {
        return queue.poll();
    }

    /**
     * null
     */
    public T head() {
        return queue.peek();
    }

    public int size() {
        return queue.size();
    }

    public static void main(String[] args) {
        System.out.println("************************Queue**********************");
        MyQueue<Integer> queue = new MyQueue<>();
        System.out.println(queue.offer(1));
        System.out.println(queue.offer(2));
        System.out.println(queue.offer(3));
        System.out.println(queue.head());
        for (int i = queue.size(); i > 0; i--) {
            System.out.print(queue.poll() + ",");
        }
    }
}
